package com.medical.medical.service;

import com.medical.medical.entity.Admin;
import com.medical.medical.mapper.AdminMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @BelongsProject: medical
 * @BelongsPackage: com.medical.medical.service
 * @authorDesc 十年生死两茫茫，写程序，到天亮
 * @Author: 喜杨杨
 * @CreateTime: 2022-09-14  11:29
 * @Description:
 * @Version: 1.0
 */
@Service
public class AdminServiceImpl implements AdminService{
    @Resource
    private AdminMapper adminMapper;
    @Override
    public Admin login(String phone, String password) {
        Admin admin = null;
        try {
            admin = adminMapper.getLoginUser(phone);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //匹配密码
        if(null != admin){
            if(!admin.getPassword().equals(password)) {
                admin = null;
            }
        }
        return admin;
    }
}
